<template>
    <div>
        {{newNum}}<br/>
        {{newUser}}<br/>
        <button @click="user.job='javaEE'">java升级成javaEE</button>
        <ul>
            <li v-for="(item,index) in list" :key="index">
                <h3>{{item.name}}</h3>
                <ul>
                    <li v-for="(_item,_index) in item.children" :key="_index">
                        {{_item.name}}
                    </li>
                </ul>
            </li>
        </ul>
    </div>
</template>
<script>
export default {
    data(){
        //1.纯数字前面加一个￥123
        //2.后端给个对象，前端需要拼接成一段内容
        //3.对一个数组进行处理，过滤
        return {
            list:[
                {id:'0',name:'北京',children:[{id: '001',name:'朝阳'}]},
                {id:'1',name:'上海',children:[{id: '101',name:'黄浦'}]},
                {id:'2',name:'广东',children:[{id: '201',name:'广州'}]},
            ],
            num:123,
            user:{
                name:'小李',
                age:25,
                job:'java'
            }
        }
    },
    computed:{
        newList(){
            //把id为0的过滤掉
            return this.list.filter(item => item.id !=='0')
        },
        newUser(){
            console.log(1);
            const {name,age,job}=this.user
            return name+'今年'+age+'岁'+'工作是'+job
        },
       newNum(){
           return '￥'+this.num
       }
    }
}
</script>